# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Dacoda Strack <dacoda.strack@gmail.com>

pkgname=cl-bordeaux-threads
_pkgname="${pkgname#cl-}"
pkgver=0.8.8
pkgrel=6
pkgdesc='Portable shared-state concurrency for Common Lisp'
arch=('any')
url='https://sionescu.github.io/bordeaux-threads/'
license=('MIT')
depends=(
  'common-lisp'
  'cl-asdf'
  'cl-alexandria'
  'cl-global-vars'
  'cl-trivial-features'
  'cl-trivial-garbage'
)
makedepends=('git')
checkdepends=('sbcl' 'cl-fiveam')
_commit='076fe2380abbc59b06e495dc7a35aea8eb26ba3b'
source=(
  "$pkgname::git+https://github.com/sionescu/bordeaux-threads#commit=$_commit"
  'run-tests.lisp'
)
b2sums=('SKIP'
        '91273084a1ebd68bdafc7ad4904d232f07046de74684575813b25eaa145eb8b7d1c6e0a2f0a114376cbe6cc30bd59f88cffdea007d0f71d36c29288fa70f733f')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./g'
}

check() {
  cd "$pkgname"

  sbcl --script ../run-tests.lisp
}

package() {
  cd "$pkgname"

  # library
  install -vd "$pkgdir/usr/share/common-lisp/source/$_pkgname"
  cp -vr src test version.sexp "$_pkgname.asd" "$pkgdir/usr/share/common-lisp/source/$_pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README site/*

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
